#ifndef CONTEXT_HPP
#define CONTEXT_HPP

#include "Common.hpp"
#include "Program.hpp"
#include "Player.hpp"
#include "Segway.hpp"
#include "Terrain.hpp"

#include <map>

class Scene;
class Camera;

struct ProgramInfo;

class Context
{
public:
  
  enum ProgramId {
    Null,
    Normal,
    SkyBox,
    Fire,
    Water,
    Wings,
    Fairy,
    FireUpdate,
    FireRender,
    ProgramCount
  };
  
  //Program * m_currentProgram;
  Scene * m_scene;
  
  Camera * m_camera;
  
  //glm::mat4 m_modelMatrix;
  
  void init();
  void initFire();
  
  Player* getPlayer();
  Segway* getSegway();
  Object* getUpdater();
  float getHeight(float x, float z);
  bool boundcheck(vec3 pos); //

  Program * getProgram() {return m_currentProgram; }
  Program * useProgram(ProgramId programId);

  Object* near(vec3 pos, const std::string & objname);
  
  std::map<ProgramId, Program*> m_progs;
  
private:
  void initPrograms();
  void initProgram();
  void skyInitProgram();
  
  
  ProgramId m_currentProgramId;
  Program * m_currentProgram;
};

extern Context g_context;

#endif // CONTEXT_HPP